#include "MyMethods.h"
#include <string>
#include <direct.h>

MyMethods::MyMethods()
{
}


MyMethods::~MyMethods()
{
}

LPCWSTR MyMethods::Int2LPCWSTR(int param)
{
	wchar_t str[10];
	_itow_s(param, str, 10);
	//int to LPCWSTR
	int age = 50;
	wchar_t ch[20];
	_stprintf_s(ch, L"%d", age);
	return ch;
}

LPCWSTR MyMethods::Int642LPCWSTR(INT64 param)
{
	std::string str = std::to_string(param);
	return stringToLPCWSTR(str);
}

LPCWSTR MyMethods::stringToLPCWSTR(std::string orig)
{
	size_t origsize = orig.length() + 1;
	const size_t newsize = 100;
	size_t convertedChars = 0;
	wchar_t *wcstring = (wchar_t *)malloc(sizeof(wchar_t)*(orig.length() - 1));
	mbstowcs_s(&convertedChars, wcstring, origsize, orig.c_str(), _TRUNCATE);

	return wcstring;
}

string MyMethods::GetCurrentPath()
{
	char buffer[MAX_PATH];
	getcwd(buffer, MAX_PATH);
	string path(buffer);
	return path;
}
